package controller

import (
	"context"
	"lot_admin_api/api"
	"lot_admin_api/internal/model"
	"lot_admin_api/internal/service"
)

var Agreement = cAgreement{}

type cAgreement struct{}

// AgreementInfo  获取协议详情
func (h *cAgreement) AgreementInfo(ctx context.Context, req *api.AgreementInfoReq) (res *model.AgreementInfoRes, err error) {
	res, err = service.Agreement().AgreementInfo(ctx, req.AgreementIdReq)
	return res, err
}

// AgreementList  获取协议列表
func (h *cAgreement) AgreementList(ctx context.Context, req *api.SearchAgreementListReq) (res *model.AgreementListRes, err error) {
	res, err = service.Agreement().AgreementList(ctx, req.SearchAgreementListReq)
	return res, err
}

// AddAgreement  添加协议
func (h *cAgreement) AddAgreement(ctx context.Context, req *api.AddAgreementReq) (res *model.AgreementIdRes, err error) {
	res, err = service.Agreement().AddAgreement(ctx, req.AddAgreementRes)
	return res, err
}

// UpdateAgreement  更新协议
func (h *cAgreement) UpdateAgreement(ctx context.Context, req *api.UpdateAgreementReq) (res *model.AgreementIdRes, err error) {
	res, err = service.Agreement().UpdateAgreement(ctx, req.AgreementInfoRes)
	return res, err
}

// DeleteAgreement  添加协议
func (h *cAgreement) DeleteAgreement(ctx context.Context, req *api.DeleteAgreementReq) (res *model.AgreementIdRes, err error) {
	res, err = service.Agreement().DeleteAgreement(ctx, req.AgreementIdReq)
	return res, err
}
